﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.Web
{
    /// <summary>
    /// http异常
    /// </summary>
    public class HttpException : Exception
    {
        private readonly int _statusCode;
        /// <summary>
        /// 异常状态码
        /// </summary>
        public int StatusCode
        {
            get { return _statusCode; }
        }


        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="statusCode">异常状态码</param>
        public HttpException(int statusCode)
        {
            this._statusCode = statusCode;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="statusCode">异常状态码</param>
        /// <param name="message">异常消息</param>
        /// <param name="exception">内部异常</param>
        public HttpException(int statusCode, string message, Exception exception)
            : base(message, exception)
        {
            this._statusCode = statusCode;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="statusCode">异常状态码</param>
        /// <param name="message">异常消息</param>
        public HttpException(int statusCode, string message)
            : base(message)
        {
            this._statusCode = statusCode;
        }
    }
}
